package com.chazz.service.impl;

import com.chazz.dao.UserDao;
import com.chazz.dao.impl.UserDaoImpl;
import com.chazz.entity.User;
import com.chazz.service.UserService;

import java.sql.SQLException;

public class UserServiceImpl implements UserService {
    UserDaoImpl udi=new UserDaoImpl();
    @Override
    public boolean updateUserInfo(User user) {
        if (udi.updateByUser(user)>0){
            return true;
        }else{
            return false;
        }
    }

    private UserDao userDao=new UserDaoImpl();
    @Override
    public User findUserById(int id) throws SQLException {
        return userDao.findUserById(id);
    }

    @Override
    public boolean addUser(User user) {
        return userDao.addUser(user);
    }

    @Override
    public User findUserByEmail(String email) throws SQLException {
        return userDao.findUserByEmail(email);
    }

    @Override
    public int findUserFinalId() throws SQLException {
        return userDao.findUserFinalId();
    }

    @Override
    public boolean updateUserPassword(User user) throws SQLException {
        return userDao.updateUserPassword(user);
    }
}
